#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 5005;

int n, m;
int a[N];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    cin >> n;
    rep(i, 1, n) cin >> a[i];
    int l = 1, r = n;
    while (l <= n && a[l]) l++;
    while (r >= 1 && a[r]) r--;
    if (l > r) {  // no zero
      cout << 1 << endl << 1 << ' ' << n << endl;
    } else if (l == r) {  // one zero;
      cout << 2 << endl;
      if (l < n) {
        cout << l << ' ' << l + 1 << endl;
        cout << 1 << ' ' << n - 1 << endl;
      } else {
        cout << l - 1 << ' ' << l << endl;
        cout << 1 << ' ' << n - 1 << endl;
      }
    } else {  // more than once
      if (l > 1 || r < n) {
        cout << 2 << endl;
        cout << l << ' ' << r << endl;
        cout << 1 << ' ' << n - (r - l) << endl;
      } else {
        cout << 3 << endl;
        int mid = n / 2;
        cout << mid + 1 << ' ' << n << endl;
        cout << 1 << ' ' << mid << endl;
        cout << 1 << ' ' << 2 << endl;
      }
    }
  }
  return 0;
}